﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VFDDriver
{
    class ConsoleDriver : IDriver
    {
        #region Instance

        private static ConsoleDriver _instance;

        public static ConsoleDriver Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new ConsoleDriver();
                return _instance;
            }
        }

        private ConsoleDriver()
        { }

        #endregion

        #region IDriver Members

        public bool Initialize()
        {
            Console.WriteLine("/--------------------\\");
            Console.WriteLine("|                    |");
            Console.WriteLine("|                    |");
            Console.WriteLine("\\--------------------/");
            return true;
        }

        public bool Terminate()
        {
            return true;
        }

        public bool WriteLine(int line, string value)
        {
            switch (line)
            {
                case 1:
                    Console.CursorLeft = 1;
                    Console.CursorTop = 1;
                    break;
                case 2:
                    Console.CursorLeft = 1;
                    Console.CursorTop = 2;
                    break;
                default:
                    break;
            }
            Console.Write(value);
            return true;
        }

        #endregion
    }
}
